import component from "element-plus/es/components/tree-select/src/tree-select-option.mjs"
import {createRouter,createWebHistory} from "vue-router"
import BellView from "../views/yonghu/BellView.vue";
import Userinfo from "../views/yonghu/Userinfo.vue";
import Edit from "../views/yonghu/Edit.vue";
import Message from "../views/yonghu/Message.vue";
import ForumPost from "../views/yonghu/ForumPost.vue";
import PostForm from "../views/yonghu/PostForm.vue";
import Losepet from "../views/yonghu/Losepet.vue";
import Petrescue from "../views/yonghu/PetRescue.vue";
import Adopt from "../views/yonghu/Adopt.vue";
import Pet from "../views/yonghu/Pet.vue";

import LoginView from "../views/LoginView.vue";

import User from "../views/admin/User.vue";
import Admin from "../views/admin/Admin.vue";
import Petmanagement from "../views/admin/PetManagement.vue";
import CommunityPost from "../views/admin/CommunityPost.vue";
import Bellmanagement from "../views/admin/BellManagement.vue";
import MessageManagement from "../views/admin/MessageManagement.vue";
import ActivityManagement from "../views/admin/ActivityManagement.vue";
import LoseManagement from "../views/admin/LoseManagement.vue";
import PetAdopt from "../views/admin/PetAdopt.vue";


const routes=[
    {
        path:'',
        name:'login',
        component:()=> import("../views/LoginView.vue"),
        redirect:'/loginout',
        children:[
            {
                path:'/loginout',
                component:LoginView
            }
        ]
    },
    {
        path:"/home",
        name:"home",
        component:() => import("../views/HomeView.vue"),
        meta:{auth:true},
        redirect:'/bell',
        children:[
            {
                path:'/bell',
                component: BellView
            },
            {
                path:'/userinfo',
                component: Userinfo
            },
            {
                path: '/edit',
                component: Edit
            },
            {
                path:'/message',
                component:Message
            },
            {
                path:'/forumpost',
                component:ForumPost
            },
            {
                path:'/postform',
                component:PostForm
            },
            {
                path:'/losepet',
                component:Losepet
            },
            {
                path:'/petrescue',
                component:Petrescue
            },
            {
                path:'/adopt',
                component:Adopt
            },
            {
                path:'/pet',
                component:Pet
            }
        ],
    },
    {
        path: '/register',
        name: 'Register',
        component:()=>import("../views/RegisterView.vue")
    },
    {
        path:'/adminview',
        name:'adminview',
        component:()=>import("../views/AdminView.vue"),
        meta:{auth:true},
        redirect:'/user',
        children:[
            {
                path:'/user',
                component: User
            },
            {
                path:'/admin',
                component:Admin
            },
            {
                path:'/petmanagement',
                component:Petmanagement
            },
            {
                path:'/communitypost',
                component:CommunityPost
            },
            {
                path:'/bellmanagement',
                component:Bellmanagement
            },
            {
                path:'/messagemanagement',
                component:MessageManagement
            },
            {
                path:'/activitymanagemet',
                component:ActivityManagement
            },
            {
                path:'/losemanagement',
                component:LoseManagement
            },
            {
                path:'/petadopt',
                component:PetAdopt
            }
        ]
    }
]
const router=createRouter({
    history:createWebHistory(),
    routes
})

export default router